<template>
  <div class="order-tab-container">
    <el-menu
      :default-active="active"
      mode="horizontal"
      menu-trigger="click"
      @select="handleSelect">
      <!-- <el-submenu index="order" class="order-tab-menu">
        <template slot="title" class="title">
          <span v-if="active === '0'">全部订单</span>
          <span v-else-if="active === '1'">待确认订单</span>
          <span v-else-if="active === '2'">执行中订单</span>
          <span v-else-if="active === '3'">已完成订单</span>
          <span v-else>全部订单</span>
        </template>
        <el-menu-item index="0" class="order-tab-menu-item">全部订单</el-menu-item>
        <el-menu-item index="1" class="order-tab-menu-item">待确认订单</el-menu-item>
        <el-menu-item index="2" class="order-tab-menu-item">执行中订单</el-menu-item>
        <el-menu-item index="3" class="order-tab-menu-item">已完成订单</el-menu-item>
      </el-submenu> -->
      <el-menu-item index="0" class="title">
        全部询单
      </el-menu-item>
      <el-menu-item index="1" class="title">
        待确认询单
      </el-menu-item>
      <el-menu-item index="2" class="title">
        执行中询单
      </el-menu-item>
      <el-menu-item index="3" class="title">
        已完成询单
      </el-menu-item>
      <el-menu-item v-if="hasRouteAuth('medium:sale:statistics')" index="total" class="title">
        统计
      </el-menu-item>
    </el-menu>
  </div>
</template>

<script>
import { hasRouteAuth } from '@/utils/permission';
export default {
  props: {
    active: {
      type: String,
      default: '0'
    }
  },
  methods: {
    hasRouteAuth,
    handleSelect(key, keyPath) {
      this.$emit('switchTab', key);
    }
  }
};
</script>

<style rel="stylesheet/scss" lang="scss" scoped>
.order-tab-container {
  background-color: #fff;
  .el-menu.el-menu--horizontal {
    height: 48px;
    width: 100%;
    padding: 0 12px;
    box-sizing: border-box;
    margin: 0 auto;
    border-bottom: none;
    box-shadow:0px 2px 0px 0px rgba(245,245,245,1);
    .el-menu-item.is-active {
      border-left: none;
    }
    .el-menu-item {
      height: 100%;
      color: #333333;
      transition: none;
    }
    & ::v-deep {
      .el-submenu__icon-arrow {
        display: inline-block !important;
        position: absolute;
        right: -15px;
        top: 50% !important;
        margin-top: -6px;
      }
    }
  }
  .el-submenu ::v-deep .el-submenu__title, .title {
    color: #333333 !important;
    font-size: 16px;
    display: flex;
    align-items: center;
    font-weight:300;
    font-family: PingFangSC-Light, PingFang SC;
    padding: 0;
    margin: 0 17px;
    padding: 0 5px;
    margin-right: 20px;
  }
  .el-submenu ::v-deep .el-submenu__title:hover, .title{
    background-color: #fff !important;
  }
  .el-submenu.is-active ::v-deep .el-submenu__title, .title.is-active {
    color:#406EFF !important;
    background-color: #fff !important;
    font-family: PingFangSC-Medium, PingFang SC;
    font-weight:500;
  }

  // .el-submenu ::v-deep {
  //   .el-submenu__title, .el-menu-item {
  //     &:hover {
  //       background-color: #fff !important;
  //     }
  //   }
  // }
}

.order-tab-menu-item {
  background: #fff !important;
  color: #333 !important;
  &:hover {
    color: #406EFF !important;
  }
  &.is-active {
    color: #406EFF !important;
  }
}
</style>
<style lang="scss">
.el-menu--horizontal  .el-menu--popup-bottom-start {
  background: #fff !important;
  &:hover {
    background: #fff !important;
  }
}
</style>
